<?php
//****************************************************
// JTBC CMS Power by Jetiben.com
// Email: jetiben@hotmail.com
// Web: http://www.jtbc.net.cn/
//****************************************************
function jtbc_cms_module_index() {
	global $db, $sort_database, $sort_idfield;
	global $nfpre, $ngenre; //自己赋值
	

	$articleList = array ();
	$articleSortList = array ();
	
	//新闻
	$ngenre = 'article';
	$ndatabase = DB_EX . $ngenre;
	$nfpre = 'a_';
	$db->sqlcmd = "select * from $sort_database where sort_genre='$ngenre' order by sort_order limit 5";
	$articleSortList = $db->execute_reader ();
	
	$db->sqlcmd = "select * from $ndatabase where " . ii_cfname ( 'hidden' ) . "=0 order by " . ii_cfname ( 'time' ) . " desc limit 8";
	$articleList = $db->execute_reader ();
	//新闻 end
	

	//优惠
	$ngenre = 'specialoffer';
	$ndatabase = $ngenre; //5G点解优惠表无前缀- -|||
	$nfpre = 'a_'; //5G点解优惠表前缀'a_'- -|||
	$db->sqlcmd = "select * from $sort_database where sort_genre='$ngenre' order by sort_order limit 5";
	$specialofferSortList = $db->execute_reader ();
	
	$specialofferList = array ();
	foreach ( $specialofferSortList as $row ) {
		$sql = "select * from $ndatabase where " . ii_cfname ( 'hidden' ) . "=0 and " . ii_cfname ( 'class' ) . "='" . $row [$sort_idfield] . "' order by " . ii_cfname ( 'time' ) . " desc limit 3";
		$db->sqlcmd = $sql;
		$specialofferList [] = $db->execute_reader ();
	}
	
	$sql = "select * from $ndatabase where " . ii_cfname ( 'hidden' ) . "=0 order by " . ii_cfname ( 'time' ) . " desc limit 2";
	$db-> sqlcmd = $sql;
	$specialofferNewList = $db->execute_reader ();
	
	//优惠 end
	

	include View ( 'index' );
}

function jtbc_cms_module() {
	return jtbc_cms_module_index ();
}
//****************************************************
// JTBC CMS Power by Jetiben.com
// Email: jetiben@hotmail.com
// Web: http://www.jtbc.net.cn/
//****************************************************
?>
